package com.huyanqi.core;

import java.io.Serializable;
/**
 * 
 * <p>Title: RetdObj.java</p>
 * 
 * <p>Description: </p>
 * 
 * <p>Datetime: 2011-12-26 上午10:17:44</p>
 *
 * @company 成都映潮科技有限公司
 * 
 * @author <a href="mailto:liwei@sunsharp.cn">p.k.ripper</a>
 *
 */
public class RetdObj<RealObj> implements Serializable {

	private static final long serialVersionUID = -5694423406140872177L;

	public static final int PASSCODE_MIN = 200;
    
    public static final int PASSCODE_MAX = 299;

    private RealObj realObj;

    private RetdCodeType retdCodeType;
    
    public RetdObj(){
        this.setCode(RetdCodeType.NODEFINE);
    }

    public RetdObj(RealObj realObj) {
        this.setCode(RetdCodeType.NODEFINE);
        this.realObj = realObj;
    }

    /**
     * service layer set retdCodeType
     * 
     * @param retdCodeType
     */
    public void setCode(RetdCodeType retdCodeType) {
        this.retdCodeType = retdCodeType;
    }

    /**
     * the page or action use this method
     * 
     * @return
     */
    public int getCode() {
        return retdCodeType.getCode();
    }
    
    public void setRealObj(RealObj realObj) {
        this.realObj = realObj;
    }

    /**
     * the page or action use this method get the real object
     * @return
     */
    public RealObj getRealObj() {
        int retdCode = retdCodeType.getCode();
        if(retdCode>=PASSCODE_MIN&&retdCode<=PASSCODE_MAX)return realObj;
        else return null;
    }

}
